﻿<?php

include("../Modules/conn.php");

$tk = $_SESSION["taikhoan"];
$_SESSION["mslop"] = $_GET["mslop"];
$mslop = $_SESSION["mslop"];

$queryNK = "select * from nhat_ky where MSCB = '$tk' and MS_LOP = '$mslop'";
$resultNK = mysql_query($queryNK, $conn) or die(mysql_error());
$count = mysql_num_rows($resultNK);

?>

<?php
	if ($count != 0)
	{
		$queryGV = "select TEN_CB from giang_vien where MSCB = '$tk'";
		$resultGV = mysql_query($queryGV, $conn) or die(mysql_error());
		$rowGV = mysql_fetch_array($resultGV);
		
		$queryLOPHP = "select TEN_LOP from lop_hp where MS_LOP = '$mslop'";
		$resultLOPHP = mysql_query($queryLOPHP, $conn) or die(mysql_error());
		$rowLOPHP = mysql_fetch_array($resultLOPHP);
		
		echo '
		<table align="center" class="info">
		<tr><td class="name">Giảng viên: </td> <td>'.$rowGV["TEN_CB"].'</td></tr>
		<tr><td class="name">Lớp: </td><td>'.$rowLOPHP["TEN_LOP"].'</td></tr></table>
		<table align="center">
		<tr> <td colspan="4" class="tableHeader"> <h4>NHẬT KÝ GIẢNG DẠY</h4> </td> </tr>
			<tr>
				<th>Ngày học</th>
				<th>Số tiết</th>
				<th>Ngày ghi nhật ký</th>
				<th>Nội dung dạy</th>
			</tr>';
		
		while ($rowNK = mysql_fetch_array($resultNK))
		{
			echo '<tr>
					 <td>'.$rowNK["NG_HOC_GV"].'</td>
					 <td>'.$rowNK["SO_TIET_GV"].'</td>
					 <td>'.$rowNK["NG_GHI_NK"].'</td>
					 <td>'.$rowNK["NOI_DUNG_DAY_GV"].'</td>
				</tr>';
		}
		echo "</table>";
	}
	else echo '<p class="notExist">Chưa có nhật ký</p>';
	
	echo '<a href="gv_cpanel.php?part=ghinkgd" class="button">Thêm mới</a>';
?>